import {Utils} from '@/utils';
import lark from '@/config';
import {httpClient} from '@/utils/request';
import Cookies from 'js-cookie';

export async function delSheet({sheetToken, type}) {
  const url = Utils.handleUrl(lark.env.api.DOCS.SHEET.V1_FILE, sheetToken);
  const uuid = Cookies.get('uuid');
  return await httpClient.delete({
    url,
    params: {
      uuid,
      type,
    },
  });
}

export async function createSheet({folderToken, title, type}) {
  const uuid = Cookies.get('uuid');
  return await httpClient.post({
    url: lark.env.api.DOCS.SHEET.V1_CREATE,
    data: {
      folder_token: folderToken,
      title,
    },
    params: {
      uuid,
      type,
    },
  });
}
